local skel = fk.CreateSkill {
  name = "emo__yingji",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__yingji"] = "应激",
  [":emo__yingji"] = "锁定技，每当你受到其他角色造成的伤害后，令其随机弃置随机数量张牌。",
}

skel:addEffect(fk.Damaged, {
  anim_type = "masochism",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name)
    and data.from and data.from ~= player and not data.from:isNude()
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local from = data.from
    if not from then return end
    local cards = table.filter(from:getCardIds("he"), function (id)
      return not from:prohibitDiscard(id)
    end)
    if #cards > 0 then
      room:throwCard(table.random(cards, math.random(1, #cards)), skel.name, from, from)
    end
  end,
})

return skel
